<!--有理想的地方，地狱都是天堂-->
<!--Copyright @ df81.com 版权所有-->
<!--作者: 南国老符 邮箱：1062129401@qq.com-->
{foreach $authrule_arr as $k => $v}
    {php}
        in_array($v['id'],$rules_array) ? $checked = "checked=\"checked\"" : $checked = "";
        $vid = $v['id']; $ruleFlag = 0;
    {/php}
    {tag:list name="authruleRs" table="auth_rule" where="parentid='$vid'" limit="1" order="sequence desc"}
        {php}$ruleFlag = 1;{/php}
	{/tag:list}
    <div class="card card-light collapsed-card">
	    <div class="card-header px-3 py-2 cursor" data-card-widget="collapse">
	    	<h6 class="card-title text-sm">{$k+1}、{$v.title}</h6>
            {if $ruleFlag eq 1}
                <div class="card-tools">
	                <button type="button" class="btn btn-tool"><i class="fas fa-plus"></i></button>
                </div>
            {/if}
	    </div>
	    {if $ruleFlag eq 1}
            <div class="card-body">
                <label class="form-check form-check-inline"><input name="rules[]" type="checkbox" value="{$v.id}" {$checked} class="mr-1" />{$v.title}</label>
                {tag:list name="authruleRs" table="auth_rule" where="parentid='$vid'" limit="10000" order="sequence desc"}
                    {php}in_array($authruleRs['id'],$rules_array) ? $childChecked = "checked=\"checked\"" : $childChecked = "";{/php}
                    <label class="form-check form-check-inline"><input name="rules[]" type="checkbox" value="{$authruleRs.id}" {$childChecked} class="mr-1" />{$authruleRs.title}</label>
                {/tag:list}
            </div>
	    {/if}
	</div>
{/foreach}